package com.qf.controller;

import com.qf.entity.TbSpeedkill;
import com.qf.service.SpeedkillService;
import com.qianfeng.util.ResultMsg;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.web.bind.annotation.*;

@RestController
public class SpeedkillController {

    @Value("${server.port}")
    String port;

    @Autowired
    SpeedkillService speedkillService;

    @GetMapping("/test")
    public String test(){
        return "当前服务端口是："+port;
    }

    @GetMapping("/speedkill/showdateMenu")
    public ResultMsg showdateMenu(){
        return speedkillService.showdateMenu();
    }

    //查询当前起始时间段内的商品
    @GetMapping("/speedkill/goods")
    public ResultMsg goods(TbSpeedkill speedkill){
        return speedkillService.showGoods(speedkill);
    }

    @GetMapping("/speedkill/buy")
    public ResultMsg speedkill(TbSpeedkill speedkill){//gid/starttime
        return speedkillService.speedkill(speedkill);
    }
}
